Skip to content

Backport of #106020: Multi-stage distributed queries#1999

Merged
zvonand merged 11 commits into
antalya-26.3from
backport/antalya-26.3/106020
Jul 21, 2026
Merged

Backport of #106020: Multi-stage distributed queries#1999
zvonand merged 11 commits into
antalya-26.3from
backport/antalya-26.3/106020

Conversation

@ianton-ru

@ianton-ru ianton-ru commented Jul 2, 2026

Copy link
Copy Markdown

Backport of ClickHouse#106020 by @davenger
Backport of ClickHouse#103880 by @groeneai
Backport of ClickHouse#103723 by @Michicosun
Backport of ClickHouse#106944 by @davenger
Backport of ClickHouse#106951 by @davenger
Backport of ClickHouse#106978 by @davenger

Changelog category (leave one):

  • Experimental Feature

Changelog entry (a user-readable short description of the changes that goes to CHANGELOG.md):

Multi-stage distributed queries (ClickHouse#106020 by @davenger)

Documentation entry for user-facing changes

Multi-stage distributed query execution: the planner splits the query plan into stages connected by scatter / broadcast / gather / shuffle exchanges and dispatches the plan fragments to worker nodes. The data between stages is streamed via TCP or passed via temporary files in shared object storage, the path supports distributed shuffle and broadcast hash joins, shuffle aggregation, and distributed sort. The feature is experimental and is disabled by default.

Depends on

Bugfixes

CI/CD Options

Exclude tests:

  • Fast test
  • Integration Tests
  • Stateless tests
  • Stateful tests
  • Performance tests
  • Aarch64 tests
  • All with ASAN
  • All with TSAN
  • All with MSAN
  • All with UBSAN
  • All with Coverage
  • All Regression
  • Disable CI Cache

Regression jobs to run:

  • Fast suites (mostly <1h)
  • Aggregate Functions (2h)
  • Alter (1.5h)
  • Benchmark (30m)
  • ClickHouse Keeper (1h)
  • Iceberg (2h)
  • LDAP (1h)
  • OAuth (5m)
  • Parquet (1.5h)
  • RBAC (1.5h)
  • SSL Server (1h)
  • S3 (2h)
  • S3 Export (2h)
  • Swarms (30m)
  • Tiered Storage (2h)

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown

Workflow [PR], commit [a7bf1bd]

ianton-ru and others added 8 commits July 13, 2026 14:22
…1499-4a82-msan-non-deterministic-filter

Fix MSan use-of-uninitialized-value in JOIN-conversion partial evaluation (issue ClickHouse#100469, STID 1499-4a82)
…_order_after_projection_use

Use projection if it will help with sorting
…plan-unknown-table

Fix logical error when table is dropped before distributed plan task deserialization
…plan-test-merge-race

Stop merges in 03394_distributed_shuffle_join_early_close_sink to fix flakiness
…-shrink-idle-thread-pools

Shrink idle thread pools of the distributed query infrastructure
@ianton-ru ianton-ru changed the title [WIP] Backport of #106020: Multi-stage distributed queries Backport of #106020: Multi-stage distributed queries Jul 14, 2026
@zvonand

zvonand commented Jul 21, 2026

Copy link
Copy Markdown
Member

@codex review

@zvonand

zvonand commented Jul 21, 2026

Copy link
Copy Markdown
Member

@blau-ai

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 567457bd95

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@blau-ai

blau-ai commented Jul 21, 2026

Copy link
Copy Markdown
Collaborator

CI triage

3 failing checks — none is a code failure introduced by this PR. Breakdown: 1 policy (DCO), 1 pre-existing/branch-wide (Iceberg regression), 1 likely flaky (Swarms regression). Everything else (Fast test, Builds, Quick functional, Source upload, Config) is green.

Check Verdict Cause
DCO ⚠️ PR-related (policy, not code) Commits missing Signed-off-by
Regression release iceberg_2 ✅ Not this PR Pre-existing branch-wide failure in Iceberg export partition tests
Regression release swarms 🟡 Likely flaky Single node-restart scenario; green on other recent PRs

1. DCO — ⚠️ PR-related, but a sign-off policy issue (not a code bug)

None of the 10 commits on this branch carry a Signed-off-by: trailer, so the DCO app fails the check.

Fix: the commits need to be re-signed, e.g. rebase the branch with sign-off:

git rebase --signoff antalya-26.3
git push --force-with-lease

(and configure git config user.name/user.email to match the committer). I can't do this myself — it requires a force-push to rewrite history, which is outside my permissions. This is orthogonal to the test results below.

2. Regression release iceberg_2 — ✅ NOT caused by this PR (pre-existing)

All failures are under /iceberg/export partition/** — the export partition transaction & lossy-cast tests:

✘ /iceberg/export partition/{no,ice,glue} catalog/transactions/commit survives pre-publish failure (non-retry cleanup)
✘ /iceberg/export partition/{no,ice,glue} catalog/casting/lossy/UInt64 narrows to Int32 without allow_lossy_cast
✘ /iceberg/export partition/{no,ice,glue} catalog/casting/out_of_bounds/...

Failing assertion is assert last_status == expected_status in the export-partition test harness.

Evidence it's not this PR:

Next step: ignore for the purposes of gating this PR; it should be tracked/fixed on antalya-26.3 independently.

3. Regression release swarms — 🟡 Most likely flaky

Only 1 of 1520 scenarios failed:

✘ /swarms/feature/node failure/check restart swarm node   (1m 52s)
    AssertionError: assert r.exitcode == exitcode, error(r.output)

This is a node-restart resiliency scenario — it kills/restarts a swarm node and asserts on a shell command's exit code, which is inherently timing-sensitive.

Evidence it's flaky rather than PR-caused:

Next step: re-run the Swarms job. If it fails again on the same scenario, the most plausible interaction point is the "Shrink idle thread pools of the distributed query infrastructure" change (backport of ClickHouse#106978), which alters distributed-infra thread-pool lifecycle — worth checking against swarm-node restart timing. I couldn't fetch the full raw.log/report.html from S3 (no network access in my environment), so the exact failing command is inferred from the job log rather than read directly.


Bottom line: no evidence this PR breaks any test. Get the commits signed off (DCO), re-run Swarms to clear the flake, and don't block on iceberg_2 — that's a pre-existing antalya-26.3 issue unrelated to this backport.

@zvonand

zvonand commented Jul 21, 2026

Copy link
Copy Markdown
Member

@ianton-ru could you pls comment on swarm fail? is it really unrelated?

The pretty-formatted report is gone, but you can see the failure in the GH job itself: https://github.com/Altinity/ClickHouse/actions/runs/29262641137/job/86882806205?pr=1999

@davenger

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Thank you!

@ianton-ru

Copy link
Copy Markdown
Author

@ianton-ru could you pls comment on swarm fail? is it really unrelated?

The pretty-formatted report is gone, but you can see the failure in the GH job itself: https://github.com/Altinity/ClickHouse/actions/runs/29262641137/job/86882806205?pr=1999

@zvonand I can't because test artifacts were removed.
Try to merge to retrigger tests

@ianton-ru

Copy link
Copy Markdown
Author

@zvonand
Found (your link is openable).

    Assertion values
      assert r.exitcode == exitcode, error(r.output)
             ^ is <testflows.connect.shell.Command object at 0x706199dbd730>
      assert r.exitcode == exitcode, error(r.output)
             ^ is = 0
      assert r.exitcode == exitcode, error(r.output)
                           ^ is 138
      assert r.exitcode == exitcode, error(r.output)
                        ^ is = False
      assert r.exitcode == exitcode, error(r.output)
      ^ is False

Yes, it's a known thing, unrelated to PR.

@zvonand

zvonand commented Jul 21, 2026

Copy link
Copy Markdown
Member

Codex found nothing, and expecting a careful manual review of a backport that has 11000 LoC would be a little ambitious :)
the CI is green, codex is happy -- I think this one can be verified and merged? @ianton-ru wdyt?

@ianton-ru

Copy link
Copy Markdown
Author

Codex found nothing, and expecting a careful manual review of a backport that has 11000 LoC would be a little ambitious :) the CI is green, codex is happy -- I think this one can be verified and merged? @ianton-ru wdyt?

Yeah, backports were without large conflicts, I think can be merged.

@zvonand
zvonand merged commit abf30a6 into antalya-26.3 Jul 21, 2026
113 of 115 checks passed
@zvonand zvonand added the verified Approved for release label Jul 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

verified Approved for release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants